/**
 * The schedule class represents a list of appointments that
 * a worker or client can have.
 *
 * @author Jeremiah Weeden
 * @version 4/10/2007
 */

package com.elderhealth.schedule;

import java.sql.*;
import com.elderhealth.util.Log;

public class Schedule
{
    /* Instance Variables */
    private Appointment[] appointments;
    private Timeslot[] timeslots;

    /**
     * Constructor for objects of class Schedule
     */
    public Schedule()
    {
      /* initialize instance variables */
      appointments = null;
      timeslots = null;
    }

    /**
     * Constructor for objects of class Schedule
     *
     * @param appts  array of appointments for schedule
     * @param times  array of timeslots for schedule
     */
    public Schedule(Appointment[] appts, Timeslot[] times)
    {
      /* initialize instance variables */
      appointments = appts;
      timeslots = times;
    }

    /* Method Section */

    /**
     * getAvailableTimeslots compares the timeslots of THIS schedule to
     * the start, end and current appointments to determine when they are free
     *
     * INCOMPLETE METHOD
     *
     * @param startTime    Time stamp to start available time at
     * @param endTime      Time stamp to end available time at
     * @return  timeslot[]
     */
    public Timeslot[] getAvailableTimeslots(Timestamp startTime,
                                            Timestamp endTime)
    {
      /* initialize variables */
      Timeslot[] times = null;
      Log logFile = Log.getInstance();

      try
      {
        /* Write algorithm here*/
        logFile.debug("Schedule: getAvailableTimeslots: " +
            " Attempting to calculate available time.");
        return times;
      }
      catch (Exception e)
      {
        logFile.error("Schedule: getAvailableTimeslots: Error " +
            "occurred. Error is: " + e.toString());
        return times;
      }
    }

    /* Accessor Section */

    /**
     * getAppointments gets all appointments associated to this schedule
     *
     * @return     appointments
     */
    public Appointment[] getAppointments()
    {
      return appointments;
    }

    /**
     * getTimeslots gets all the timeslots associated to this schedule
     * appointments
     *
     * @return  timeslots
     */
    public Timeslot[] getTimeslots()
    {
      return timeslots;
    }
}
